<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeecmsMenuTable extends Migration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */

    protected $name = 'seecms_menu';

    public function up()
    {
        Schema::create($this->name, function (Blueprint $table) {
            $table->id();
            $table->integer('parent_id')->default(0);
            $table->string('title')->comment('菜单名称');
            $table->string('icon')->comment('图标')->default('');
            $table->string('url')->comment('路由地址');
            $table->string('condition')->comment('规则条件')->default('');
            $table->string('remark')->comment('备注')->default('');
            $table->tinyInteger('type')->comment('菜单类型 0 目录 directory 1 菜单 menu')->default(1);
            $table->string('open_type')->comment('打开类型 当type为1时，openType生效，_iframe 正常打开 _blank 新建浏览器标签页')->default('_iframe');
            $table->string('extent')->comment('扩展属性')->default('');
            $table->integer('sort')->comment('排序')->default(999);
            $table->tinyInteger('status')->comment('用户状态')->default(1);
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists($this->name);
    }
}
